/**
 * Copyright (c) 2013-2022 Nikita Koksharov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.redisson.client.protocol.convertor;


/**
 * BooleanNullReplayConvertor类实现了Convertor<Boolean>接口，用于将对象转换为Boolean类型。
 * 该转换器的特殊之处在于，它将null对象转换为Boolean类型的true，非null对象转换为false。
 * 这种转换逻辑基于一个假设：在特定上下文中，null值表示一种特定的真值。
 */
public class BooleanNullReplayConvertor implements Convertor<Boolean> {

    /**
     * 将给定对象转换为Boolean类型。
     * 该方法的核心逻辑是判断输入对象是否为null，并根据判断结果返回相应的Boolean值。
     * @param obj 待转换的对象。可以是任何类型的对象。
     * @return 如果输入对象为null，则返回true；否则返回false。
     */
    @Override
    public Boolean convert(Object obj) {
        return obj == null;
    }
}
